package br.com.fogas.medicao.activity.validation;

import android.view.View;
import br.com.fogas.medicao.R;
import br.com.fogas.medicao.activity.helper.LeituraMedidorHelper;
import br.com.fogas.utils.StringUtility;
import br.com.fogas.utils.validacao.PreenchidoQtdCaracteres;
import br.com.fogas.utils.validacao.ValidacaoResponsability;

public class LeituraMedidorValidacao {

	public static boolean validar(LeituraMedidorHelper helper) {
		View view = helper.getEtContMedidor();
		
		int maxLength = StringUtility.trim(helper.getMedidor().getNb_max_cont()).length();
		String message = helper.getFragment().getString(R.string.leitura_medidor_val_informe_leitura_corretamente);
		message = StringUtility.replace(message, "#P#", String.valueOf(maxLength));
	
		ValidacaoResponsability preenchidoCorretamente = new PreenchidoQtdCaracteres(view, message, maxLength);
		return preenchidoCorretamente.campoValido();
	}
}
